package com.md.api.common.utils;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


/**
 * Created by xzr on 2018/7/5.
 */
public class VerifyUtil {

    public static boolean isMiss(Object... objects){
        for(Object object : objects) {
            if (null == object || StringUtils.isBlank(object.toString())){
                return true;
            }
        }
        return false;
    }

    /**
     * @param imgPath
     * @return
     */
    public static boolean isImage(String imgPath) {
        String reg = ".+(.JPEG|.jpeg|.JPG|.jpg|.GIF|.gif|.BMP|.bmp|.PNG|.png)$";
        Pattern pattern = Pattern.compile(reg);
        Matcher matcher = pattern.matcher(imgPath.toLowerCase());
        return matcher.find();
    }
    
    /**
	 * 判断字符串中是否含有英文，包含返回true 建议移到工具类中
	 * @param string
	 * @return
	 */
    public static boolean isENChar(String string) {
    	boolean flag = false;
    	Pattern p = Pattern.compile("[a-zA-z]");
        if(p.matcher(string).find()) {
        	flag = true;
        }
        return flag;
    }
    
    public static void main(String[] args) {
		Map<String, Object> map = new HashMap<>();
		map.put("version", "1.0.0");
		map.put("model", "HUAWEINOTE10");
		map.put("code", "gfqewgcjnastf");
		map.put("type", "ANDROID");
		map.put("mac", "asfdqqe3123123");
	}
}
